<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="dashboardMenuTag" value="myOrg" scope="request"></c:set>

<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台1</title>
    <jsp:include page="../../commons/include.jsp"/>



    <script>
        $(function () {
            $(".pagination li a").each(function (index) {

                $(this).on('click', function () {
                    var page = $(this).attr("page");
                    var form = $("form");
                    $('form input[name="page"]').val(page);
                    $("form").submit();
                })

            });

            $("#orgs li a").each(function () {
                $(this).on('click', function () {
                    $('form input[name="orgId"]').val($(this).attr('orgId'));
                    $("form").submit();
                });
            });

            $('form button[type="submit"]').on('click', function () {
                $('form input[name="orgId"]').val('');
                return true;
            });
        });


    </script>


</head>
<body>


<jsp:include page="../commons/top.jsp"/>


<div id="main">

    <div>
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li><a href="/front/dataset/list">数据集</a></li>
        </ol>
    </div>

    <div class="left">
        <div>
            <div class="title">通过位置过滤</div>
            <div class="content">
                <div style="width: 100%; height: 150px; border: 1px solid #eeeeee">
                </div>
            </div>
        </div>


        <div>
            <div class="title">组织</div>
            <div class="content">
                <div style="width: 100%; min-height: 350px; border: 1px solid #eeeeee;padding: 10px 16px;">
                    <ul style="list-style: none" id="orgs">
                        <c:forEach items="${requestScope.orgs}" var="org">
                            <li style="">

                                <c:choose>
                                    <c:when test="${orgId==org.id}">
                                        ${org.name}(${org.total})
                                    </c:when>
                                    <c:otherwise>
                                        <a href="javascript:void(0);" orgId="${org.id}">${org.name}(${org.total})</a>
                                    </c:otherwise>
                                </c:choose>


                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </div>


    </div>
    <div class="right" style=" width: 700px;height: auto;">
        <div style="height: 150px;">
            <form method="get" ACTION="/front/dataset/list">
                <input type="hidden" name="page" value="1">
                <input type="hidden" name="orgId" value="${requestScope.orgId}">

                <div class="col-lg-6" style="padding: 30px 50px;">
                    <div class="input-group" style="width: 430px;">
                        <input type="text" name="name" class="form-control" value="${requestScope.name}"
                               style="width: 400px">
                         <span class="input-group-btn">

           <button class="btn btn-default" type="submit">搜 索</button>
                        </span>
                    </div>
                </div>


                <div style="clear: both; height: 60px;">
                    <div style="float:left; width: 266px; height: 100%; font-size: 18px; font-weight: bold; padding-left: 50px;">
                        共找到${requestScope.result.pageResult.total}个数据集
                    </div>
                    <div style="float: left; width: 400px;height: 100% font-size: 22px; font-weight: bold;">排序：
                        <select class="form-control" name="order" style="width: 200px; display: inline">
                            <option value="asc">名称升序</option>
                            <option value="desc" <c:if test="${order=='desc'}"> selected="selected"</c:if>>名称降序</option>

                        </select></div>
                </div>
            </form>


        </div>


        <div>
            <ul class="pagination" style="margin: 20px 30px;">
                <li><a href="javascript:void(0);" page="${requestScope.result.pageResult.startPage-1}">&laquo;</a></li>

                <c:forEach begin="${requestScope.result.pageResult.startPage}"
                           end="${requestScope.result.pageResult.endPage}" var="index">
                    <li <c:if test="${index==requestScope.result.pageResult.page}"> class="active" </c:if>  ><a
                            href="javascript:void(0);" page="${index}">${index}</a></li>
                </c:forEach>

                <li><a href="javascript:void(0);" page="${requestScope.result.pageResult.endPage+1}">&raquo;</a></li>
            </ul>
        </div>


        <div style="padding-left: 40px;">
            <c:forEach items="${requestScope.result.pageResult.rows}" var="dataset">
                <div style="line-height: 34px;">
                    <div style="margin-top: 10px; font-size: 16px; font-weight: bold;"><a
                            href="/front/dataset/detail?id=${dataset.id}">${dataset.name}</a></div>
                    <div style="min-height: 40px;">
                        <c:choose>
                            <c:when test="${not empty dataset.description}">${dataset.description}</c:when><c:otherwise>该项没有简介</c:otherwise>
                        </c:choose>
                    </div>
                    <div style="border-bottom: 1px dashed rgb(221,221,221);"><span></span></div>
                </div>
            </c:forEach>
        </div>


        <div>
            <ul class="pagination" style="margin: 20px 30px;">
                <li><a href="javascript:void(0);" page="${requestScope.result.pageResult.startPage-1}">&laquo;</a></li>

                <c:forEach begin="${requestScope.result.pageResult.startPage}"
                           end="${requestScope.result.pageResult.endPage}" var="index">
                    <li <c:if test="${index==requestScope.result.pageResult.page}"> class="active" </c:if>  ><a
                            href="javascript:void(0);" page="${index}">${index}</a></li>
                </c:forEach>

                <li><a href="javascript:void(0);" page="${requestScope.result.pageResult.endPage+1}">&raquo;</a></li>
            </ul>
        </div>


    </div>


</div>


</div>

<jsp:include page="../commons/buttom.jsp"/>
</body>
</html>
